﻿using System;
using System.Reflection;
using System.Web.Mvc;
using System.Web.Routing;

namespace PIM.Web.Infrastruture
{
    public class PIMControllerFactory : DefaultControllerFactory
    {
#region Member Vars
        private readonly DependencyInjectHandler _diHandler;
#endregion
#region Constructors
        public PIMControllerFactory(DependencyInjectHandler diHandler)
        {
            _diHandler = diHandler;
            _diHandler.RegisterControllersInAssemblly(Assembly.GetExecutingAssembly());

        }
#endregion
#region Public Methods
        protected override IController GetControllerInstance(RequestContext requestContxt, Type controllerType)
        {
            return _diHandler.GetControllerInstance(controllerType);
        }
#endregion
    }
}
